

using System.Text.Json.Serialization;

namespace IMClient.Model.DTO
{
    public class GroupDto
    {
        [JsonPropertyName("groupId")]
        public string? GroupId { get; set; } = null;

        [JsonPropertyName("groupName")]
        public string? GroupName { get; set; } = null;

        [JsonPropertyName("avatar")]
        public string Avatar { get; set; } = "https://im-net.oss-cn-wuhan-lr.aliyuncs.com/group-profile-avatar.jpg";

        [JsonPropertyName("creator")]
        public string Creator { get; set; } = null!;  // 群主
        
        public string[] AdminId { get; set; } = Array.Empty<string>();

        public string[] Members { get; set; } = Array.Empty<string>();
        
        public override bool Equals(object? obj)
        {
            if (obj is GroupDto other)
            {
                return GroupId == other.GroupId &&
                       GroupName == other.GroupName &&
                       Avatar == other.Avatar;
            }
            return false;
        }

        public override int GetHashCode()
        {
            return HashCode.Combine(GroupName, GroupId, Avatar);
        }
    }
}
